package com.cn.demo4.util;

public class Tool {
    public static Integer stringToInt(String value) {
        int result = 0;
            try {
                result = Integer.parseInt(value);
            } catch (Exception e) {
//                e.printStackTrace();
            }
        return result;
    }


    public static Double stringToDouble(String value) {
        Double result = 0.0;
        try {
            result = Double.parseDouble(value);
        } catch (Exception e) {
//            e.printStackTrace();
        }
        return result;
    }

    /**
     * curPage页码默认为1
     * @param value
     * @return
     */
    public static Integer toCurPage(String value) {
        int result = 1;
        try {
            result = Integer.parseInt(value);
        } catch (Exception e) {
//            e.printStackTrace();
        }
        return result;
    }

    /**
     * pageSize默认每页显示10条
     * @param value
     * @return
     */
    public static Integer toPageSize(String value) {
        int result = 10;
        try {
            result = Integer.parseInt(value);
        } catch (Exception e) {
//            e.printStackTrace();
        }
        return result;
    }


}
